refactor binding (WIP)

Signed-off-by: Laurent ARNAL <laurent@clae.net>
This commit is contained in:
Laurent ARNAL 2024-04-21 17:14:11 +02:00
parent e45f6a0615
commit e04cfea00a
5 changed files with 44 additions and 54 deletions

View File

@ -100,13 +100,11 @@ public class LinkyHandlerFactory extends BaseThingHandlerFactory {
this.httpService = httpService; this.httpService = httpService;
this.thingRegistry = thingRegistry; this.thingRegistry = thingRegistry;
this.componentContext = componentContext; this.componentContext = componentContext;
} }
@Override @Override
public boolean supportsThingType(ThingTypeUID thingTypeUID) { public boolean supportsThingType(ThingTypeUID thingTypeUID) {
return LinkyBindingConstants.SUPPORTED_DEVICE_THING_TYPES_UIDS.contains(thingTypeUID); return LinkyBindingConstants.SUPPORTED_DEVICE_THING_TYPES_UIDS.contains(thingTypeUID);
} }
@Override @Override
@ -125,7 +123,5 @@ public class LinkyHandlerFactory extends BaseThingHandlerFactory {
} }
return null; return null;
} }
} }

View File

@ -155,7 +155,6 @@ public class ApiBridgeHandler extends BaseBridgeHandler {
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
} }
}); });
} }
/* /*
@ -173,7 +172,6 @@ public class ApiBridgeHandler extends BaseBridgeHandler {
@Override @Override
public void handleCommand(ChannelUID channelUID, Command command) { public void handleCommand(ChannelUID channelUID, Command command) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override @Override
@ -200,7 +198,6 @@ public class ApiBridgeHandler extends BaseBridgeHandler {
} catch (NamespaceException | ServletException | IOException e) { } catch (NamespaceException | ServletException | IOException e) {
logger.warn("Error during linky servlet startup", e); logger.warn("Error during linky servlet startup", e);
} }
} }
/** /**
@ -331,5 +328,4 @@ public class ApiBridgeHandler extends BaseBridgeHandler {
return result; return result;
} }
} }

View File

@ -51,5 +51,4 @@ public class EnedisBridgeHandler extends ApiBridgeHandler {
super.dispose(); super.dispose();
} }
} }

View File

@ -51,5 +51,4 @@ public class MyElectricalDataBridgeHandler extends ApiBridgeHandler {
super.dispose(); super.dispose();
} }
} }

View File

@ -4,50 +4,50 @@
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0" xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd"> xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<bridge-type id="EnedisBridge"> <bridge-type id="EnedisBridge">
<label>EnedisBridge</label> <label>EnedisBridge</label>
<description> <description>
Provides your energy consumption data. Provides your energy consumption data.
In order to receive the data, you must activate your account at In order to receive the data, you must activate your account at
https://espace-client-particuliers.enedis.fr/web/espace-particuliers/compteur-linky. https://espace-client-particuliers.enedis.fr/web/espace-particuliers/compteur-linky.
</description> </description>
<config-description> <config-description>
<parameter name="clientId" type="text" required="false"> <parameter name="clientId" type="text" required="false">
<label>clientId</label> <label>clientId</label>
<description>Your Enedis clientId</description> <description>Your Enedis clientId</description>
</parameter> </parameter>
<parameter name="clientSecret" type="text" required="false"> <parameter name="clientSecret" type="text" required="false">
<label>clientSecret</label> <label>clientSecret</label>
<description>Your Enedis clientSecret</description> <description>Your Enedis clientSecret</description>
</parameter> </parameter>
</config-description> </config-description>
</bridge-type> </bridge-type>
<bridge-type id="MyElectricalDataBridge"> <bridge-type id="MyElectricalDataBridge">
<label>EnedisBridge</label> <label>EnedisBridge</label>
<description> <description>
Provides your energy consumption data. Provides your energy consumption data.
In order to receive the data, you must activate your account at In order to receive the data, you must activate your account at
https://espace-client-particuliers.enedis.fr/web/espace-particuliers/compteur-linky. https://espace-client-particuliers.enedis.fr/web/espace-particuliers/compteur-linky.
</description> </description>
<config-description> <config-description>
<parameter name="token" type="text" required="false"> <parameter name="token" type="text" required="false">
<label>Token</label> <label>Token</label>
<description>Your Enedis token (can be left empty, use the connection page to automatically fill it <description>Your Enedis token (can be left empty, use the connection page to automatically fill it
http://youopenhab/connectlinky)</description> http://youopenhab/connectlinky)</description>
</parameter> </parameter>
</config-description> </config-description>
</bridge-type> </bridge-type>
<thing-type id="linky"> <thing-type id="linky">
<supported-bridge-type-refs> <supported-bridge-type-refs>
<bridge-type-ref id="EnedisBridge"/> <bridge-type-ref id="EnedisBridge"/>
<bridge-type-ref id="MyElectricalDataBridge"/> <bridge-type-ref id="MyElectricalDataBridge"/>
</supported-bridge-type-refs> </supported-bridge-type-refs>
<label>Linky</label> <label>Linky</label>
<description> <description>