Add time to the sensor list widget, also broadcast and recive the time of a sensor

This commit is contained in:
uvos 2023-11-08 23:35:50 +01:00
parent 260334ef35
commit a301bdbaa7
15 changed files with 557 additions and 266 deletions

View file

@ -23,6 +23,7 @@ MainObject::MainObject(QIODevice* ioDevice, const QString& settingsPathIn, const
QObject::connect(&ocupancySensor, &OcupancySensorSource::stateChanged, &globalSensors, &SensorStore::sensorGotState);
sunSensorSource.run();
//pwHandler.startLoop();
//connect item store
QObject::connect(&micro, &Microcontroller::gotRelayList, &items, &ItemStore::addItems);
@ -35,14 +36,17 @@ MainObject::MainObject(QIODevice* ioDevice, const QString& settingsPathIn, const
items.addItem(auxItem);
MessageItem::broadCast = &broadCast;
Relay::setMicrocontroller(&micro);
connect(&broadCast, &BroadCast::gotJson, this, &MainObject::recivedJson);
QObject::connect(&broadCast, &BroadCast::gotSensorState, &globalSensors, &SensorStore::sensorGotState);
if(master)connect(&broadCast, &BroadCast::jsonRequested, this, &MainObject::sendJson);
if(master)
connect(&broadCast, &BroadCast::jsonRequested, this, &MainObject::sendJson);
if(master) load(getJsonObjectFromDisk(settingsPath, &noSave));
if(master)
{
load(getJsonObjectFromDisk(settingsPath, &noSave));
}
else
{
broadCast.requestJson();